<?php
/**
 * UserDataService.php
 *
 * @copyright   2023 thingsworld.com.cn - All Rights Reserved
 * @link        http://thingsworld.com.cn/
 * @author      stiffer.chen <chenl@thingsworld.com.cn>
 * @created     2023-04-12 17:22:50
 * @modified    2023-04-12 17:22:50
 *
 */

namespace App\Services;

use App\Models\PositionModel;

class UserDataService
{
    private $userId;

    public function __construct($userId)
    {
        $this->userId = $userId;
    }

    public function getPosition()
    {
        $position = PositionModel::query()
            ->from('position')
            ->join('user', 'user.position_id', '=', 'position.id')
            ->where('user.id', $this->userId)
            ->first();
        return $position;
    }
}